package com.brayan.melinxa.logic.execution;

import java.util.ArrayList;
import java.util.List;

/**
 * Responsible either copy or delete.
 */
public class Executor {

	static Executor executor = null;
	List<Executable> execs = null;

	private Executor() {
		execs = new ArrayList<Executable>();
	}

	public static Executor getInstance() {
		if (executor == null) {
			executor = new Executor();
		}
		return executor;
	}

	public void addExecutable(Executable exec) {
		// execs.add(exec);
		Thread t = new Thread(exec);
		t.setName("MM::Exec:" + exec.getExecutableType() + ":" + Math.round(Math.random() * 10000));
		// TODO set to min priority
		t.setPriority(Thread.MIN_PRIORITY);
		t.start();
	}

}
